package com.xpec.canaan.util;

import java.util.ArrayList;

public class EventMessageRecorder {
	
	public EventMessageRecorder()
	{
		messageContents = new ArrayList<String>();
	}
	
	public EventMessageRecorder(String mainEvent)
	{
		m_mainEvent = mainEvent;
		messageContents = new ArrayList<String>();
	}
	
	public void setMainEvent(String event)
	{
		m_mainEvent = event;
	}
	
	public void setSubEvent(String event)
	{
		m_subEvent = event;
	}
	
	public void addMessage(String message)
	{
		messageContents.add(message);
	}
	
	public String getMainEvent()
	{
		return m_mainEvent;
	}
	
	public String getSubEvent()
	{
		return m_subEvent;
	}
	
	public ArrayList<String> getMessage()
	{
		return messageContents;
	}
	
	public String toString()
	{
		String content = m_mainEvent + "\r" + m_subEvent + "\r";
		if( 0 < messageContents.size() )
		{
			content += messageContents.get(0) + "/n";
		}
		
		for(int i = 1; i < messageContents.size(); i++)
		{
			content += "\r\r" + messageContents.get(i) + "\n";
		}
		
		return content;
	}
	
	private String m_mainEvent;
	
	private String m_subEvent;
	
	private ArrayList<String> messageContents;

}
